/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package projekt;

import java.awt.Color;
import java.awt.Component;
import java.awt.Dimension;
import java.awt.Font;
import java.awt.Toolkit;
import javax.swing.BoxLayout;
import javax.swing.JFrame;
import javax.swing.JLabel;
import javax.swing.JPanel;

/**
 *
 * @author Mikael
 */
public class GameOver extends JFrame {

    private final int sizeX = 600;
    private final int sizeY = 400;
    private int scoreX = 100;
    private int scoreY = 40;
    private Dungeon dg;

    /**
     * Game over constructor.
     */
    public GameOver(Dungeon dgx) {
        dg = dgx;
        Dimension dim = Toolkit.getDefaultToolkit().getScreenSize();
        int x = (dim.width - sizeX) / 2;
        int y = (dim.height - sizeY) / 2;
        setLocation(x, y);
        setTitle("Diablo 0.5");
        setSize(sizeX, sizeY);
        setResizable(false);
        setVisible(false);
        toFront();
        setAlwaysOnTop(true);
        setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
        setBackground(Color.black);
    }

    public void lost(HighScore h) {
        Font f = new Font("Dialog", Font.PLAIN, 24);
        JPanel scores = new JPanel();
        scores.setForeground(Color.WHITE);
        scores.setBackground(Color.BLACK);
        scores.setLayout(new BoxLayout(scores, BoxLayout.Y_AXIS));
        this.add(scores);
        JLabel hScore = new JLabel("High Scores:");
        hScore.setFont(f);
        hScore.setAlignmentX(Component.CENTER_ALIGNMENT);
        scores.add(hScore);
        for (int x = 0; x < 8; x++) {
            JLabel n = new JLabel(h.getName(x) + ": " + h.getGold1(x));
            n.setFont(f);
            scores.add(n);
        }

        setVisible(true);
    }
}
